package selcoursesys.service.impl;

import selcoursesys.dao.SelectionDAO;
import selcoursesys.dao.impl.SelectionDAOImpl;
import selcoursesys.entity.CourseEntity;
import selcoursesys.entity.CourseInfo;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by Lpbdz on 2017/4/13.
 */
public class InputCourseInfo {
    public static void inputCourseInfo(List<CourseInfo> courseInfos,CourseEntity courseEntity,String stuid,String ctype){
        //判断选课信息表里是否存在

        String exitselect="";
        SelectionDAO selectionDAO=new SelectionDAOImpl();
        if(selectionDAO.checkSelectionExit(courseEntity.getCourseid(),stuid)==true){
            exitselect="已选";
        }else{
            exitselect="未选";
        }
        //String coursename, Double credit, String courseid, String tname,String exitselct,String stuid,String ctype
        if(ctype.equals("ALL")==false||(ctype.equals("ALL")&&exitselect.equals("已选")))
        courseInfos.add(new CourseInfo(courseEntity.getCourseid(),courseEntity.getCoursename(),courseEntity.getCredit(),courseEntity.getTeacherEntity().getTname(),
                exitselect,stuid,courseEntity.getCoursetype()));
    }
}
